/// momentId : 100
/// title : "嘿嘿"
/// likeCnt : 1
/// imageUrl : "https://scpic.chinaz.net/files/default/imgs/2022-08-10/02c85a3a60d998c5_s.jpg"
/// imageHeight : 345.0
/// commentCnt : 1
/// userBaseInfo : {"userId":100,"avatar":"https://randomuser.me/api/portraits/men/71.jpg","userName":"JacceYang"}

class HomeItemModel {
  HomeItemModel({
      this.momentId, 
      this.title, 
      this.likeCnt, 
      this.imageUrl, 
      this.imageHeight, 
      this.commentCnt, 
      this.userBaseInfo,});

  HomeItemModel.fromJson(dynamic json) {
    momentId = json['momentId'];
    title = json['title'];
    likeCnt = json['likeCnt'];
    imageUrl = json['imageUrl'];
    imageHeight = json['imageHeight'];
    commentCnt = json['commentCnt'];
    userBaseInfo = json['userBaseInfo'] != null ? UserBaseInfo.fromJson(json['userBaseInfo']) : null;
  }
  num? momentId;
  String? title;
  num? likeCnt;
  String? imageUrl;
  num? imageHeight;
  num? commentCnt;
  UserBaseInfo? userBaseInfo;
HomeItemModel copyWith({  num? momentId,
  String? title,
  num? likeCnt,
  String? imageUrl,
  num? imageHeight,
  num? commentCnt,
  UserBaseInfo? userBaseInfo,
}) => HomeItemModel(  momentId: momentId ?? this.momentId,
  title: title ?? this.title,
  likeCnt: likeCnt ?? this.likeCnt,
  imageUrl: imageUrl ?? this.imageUrl,
  imageHeight: imageHeight ?? this.imageHeight,
  commentCnt: commentCnt ?? this.commentCnt,
  userBaseInfo: userBaseInfo ?? this.userBaseInfo,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['momentId'] = momentId;
    map['title'] = title;
    map['likeCnt'] = likeCnt;
    map['imageUrl'] = imageUrl;
    map['imageHeight'] = imageHeight;
    map['commentCnt'] = commentCnt;
    if (userBaseInfo != null) {
      map['userBaseInfo'] = userBaseInfo?.toJson();
    }
    return map;
  }

}

/// userId : 100
/// avatar : "https://randomuser.me/api/portraits/men/71.jpg"
/// userName : "JacceYang"

class UserBaseInfo {
  UserBaseInfo({
      this.userId, 
      this.avatar, 
      this.userName,});

  UserBaseInfo.fromJson(dynamic json) {
    userId = json['userId'];
    avatar = json['avatar'];
    userName = json['userName'];
  }
  num? userId;
  String? avatar;
  String? userName;
UserBaseInfo copyWith({  num? userId,
  String? avatar,
  String? userName,
}) => UserBaseInfo(  userId: userId ?? this.userId,
  avatar: avatar ?? this.avatar,
  userName: userName ?? this.userName,
);
  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['userId'] = userId;
    map['avatar'] = avatar;
    map['userName'] = userName;
    return map;
  }

}